C++ Programming for Linux Systems by Desislav Andreev
Author:Desislav Andreev
Language: eng
Format: mobi, epub
Publisher: Packt Publishing Pvt Ltd
Published: 2023-09-20T00:00:00+00:00
Account& operator+=(unsigned amount) noexcept {
Print(" balance before depositing: ", balance,
owner);
auto temp{balance}; // {1}
std::this_thread::sleep_for(1ms);
balance = temp + amount; // {2}
Print(" balance after depositing: ", balance,
owner);
return *this;
}
Account& operator-=(unsigned amount) noexcept {
Print(" balance before withdrawing: ", balance,
owner);
auto temp{balance}; // {1}
balance = temp - amount; // {2}
Print(" balance after withdrawing: ", balance,
owner);
return *this;
}
Looking into the implementation of the operator functions shows that they first read the current balance of the account, then store it in a local object (marker {1}), and finally, using the value of the local object, they increment or decrement with the specified amount.
As simple as it gets!
The resulting value of the new balance of the account is written back into the balance member of the Account structure (marker {2}).
We also need to define a method that will be responsible for the actual money transfer:
Download
C++ Programming for Linux Systems by Desislav Andreev.epub
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7358)
Linux Device Driver Development Cookbook by Rodolfo Giometti(3457)
MCSA Windows Server 2016 Study Guide: Exam 70-740 by William Panek(2319)
The Infinite Retina by Robert Scoble Irena Cronin(2285)
Kali Linux - An Ethical Hacker's Cookbook: End-to-end penetration testing solutions by Sharma Himanshu(2107)
Docker on Windows by Stoneman Elton(2095)
Hands-On AWS Penetration Testing with Kali Linux by Karl Gilbert(1857)
Computers For Seniors For Dummies by Nancy C. Muir(1776)
Hands-On Linux for Architects by Denis Salamanca(1759)
Filmora Efficient Editing by Alexander Zacharias(1734)
The Old New Thing by Raymond Chen(1729)
Programming in C (4th Edition) (Developer's Library) by Stephen G. Kochan(1711)
MCSA Windows Server 2016 Study Guide: Exam 70-741 by William Panek(1484)
Installing and Configuring Windows 10: 70-698 Exam Guide by Bekim Dauti(1425)
Mastering PowerShell Scripting - Fourth Edition by Chris Dent(1418)
Embedded Systems Architecture by Daniele Lacamera(1387)
Mastering Kubernetes by Gigi Sayfan(1370)
Learn Computer Forensics by William Oettinger(1360)
Database Reliability Engineering: Designing and Operating Resilient Database Systems by Campbell Laine & Majors Charity(1352)